<?php

include "MyPDO.php";

$db=new MyPDO();
//$users1=$db->insert("INSERT INTO `test123`.`studentlist` (`学号`, `姓名`, `性别`, `出生日期`,`入学日期`,`电话号码`,`籍贯`,`备注`) VALUES ('3', '怪物1', '男', '1980-10-5','2009-9-1','15012345677','长沙','asd'); ");
//$users2=$db->insert("INSERT INTO `test123`.`achievementtable` (`成绩编号`, `课程号`, `学号`, `成绩`) VALUES ('3', '3', '3', '55');");
//$users3=$db->insert("INSERT INTO `test123`.`timetable` (`课程号`, `课程名`,`教师姓名`) VALUES ('3', '怪物学','废物'); ");


$users=$db->select("SELECT * FROM AchievementTable sc LEFT JOIN Timetable  c  ON sc.`课程号`= c.`课程号` JOIN StudentList s ON s.`学号` = sc.`学号`;");
echo json_encode($users);

$users4=$db->select("SELECT * FROM studentlist WHERE `籍贯`= '长沙';");
var_dump($users4);

$users5=$db->select("SELECT * FROM AchievementTable WHERE `学号` =  (SELECT `学号` FROM StudentList WHERE `姓名` = '云宰');");
var_dump($users5);

$users6=$db->select("SELECT AVG(`成绩`) FROM Achievementtable WHERE `学号` = '1';");
var_dump($users6);



